/* Chart trade plan layer. Keeps trade details below the chart instead of covering candles. */

html body #chart-trades-settings-slot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

html body .chart-trades-toggle {
  min-height: 28px;
}

html body .chart-trades-history-toggle {
  white-space: nowrap;
}

html body .chart-trades-panel-slot {
  box-sizing: border-box;
  width: calc(100vw - 12px);
  max-width: calc(100vw - 12px);
  margin: 10px calc(50% - 50vw) 16px calc(50% - 50vw + 12px);
}

html body .chart-trades-panel-slot[hidden] {
  display: none !important;
}

html body .chart-trades-tv-overlay {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  z-index: 8 !important;
  overflow: hidden !important;
  pointer-events: none !important;
  user-select: none !important;
}

html body .chart-trades-tv-box {
  position: absolute !important;
  top: 0 !important;
  bottom: 0 !important;
  min-width: 96px !important;
  opacity: 0.82 !important;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.2)) !important;
  pointer-events: auto !important;
}

html body .chart-trades-tv-box.is-alternative {
  opacity: 0.34 !important;
}

html body .chart-trades-tv-box.is-weak {
  opacity: 0.54 !important;
}

html body .chart-trades-tv-box.is-history {
  min-width: 0 !important;
  opacity: 0.62 !important;
}

html body .chart-trades-tv-box.is-history.is-history-alt {
  opacity: 0.42 !important;
}

html body .chart-trades-tv-box.is-history .chart-trades-tv-label {
  color: rgba(255, 247, 204, 0.84) !important;
  background: rgba(8, 12, 22, 0.58) !important;
}

html body .chart-trades-tv-box.is-history.is-history-win .chart-trades-tv-label {
  color: rgba(220, 252, 231, 0.95) !important;
  background: rgba(5, 46, 22, 0.78) !important;
  border-color: rgba(34, 197, 94, 0.7) !important;
}

html body .chart-trades-tv-box.is-history.is-history-loss .chart-trades-tv-label {
  color: rgba(254, 226, 226, 0.95) !important;
  background: rgba(69, 10, 10, 0.78) !important;
  border-color: rgba(239, 68, 68, 0.72) !important;
}

html body .chart-trades-tv-box.is-history .chart-trades-tv-entry {
  border-top-color: rgba(250, 204, 21, 0.58) !important;
}

html body .chart-trades-tv-box.is-history.is-history-win .chart-trades-tv-zone {
  border-color: rgba(34, 197, 94, 0.58) !important;
  background:
    linear-gradient(90deg, rgba(34, 197, 94, 0.18), rgba(34, 197, 94, 0.08)) !important;
}

html body .chart-trades-tv-box.is-history.is-history-win .chart-trades-tv-entry {
  border-top-color: rgba(34, 197, 94, 0.82) !important;
}

html body .chart-trades-tv-box.is-history.is-history-loss .chart-trades-tv-zone {
  border-color: rgba(239, 68, 68, 0.58) !important;
  background:
    linear-gradient(90deg, rgba(239, 68, 68, 0.2), rgba(239, 68, 68, 0.08)) !important;
}

html body .chart-trades-tv-box.is-history.is-history-loss .chart-trades-tv-entry {
  border-top-color: rgba(239, 68, 68, 0.84) !important;
}

html body .chart-trades-tv-zone {
  position: absolute !important;
  left: 0 !important;
  right: 0 !important;
  border-left: 1px solid transparent !important;
  border-right: 1px solid transparent !important;
  mix-blend-mode: normal !important;
}

html body .chart-trades-tv-zone.is-profit {
  border-color: rgba(34, 197, 94, 0.28) !important;
  background:
    linear-gradient(90deg, rgba(34, 197, 94, 0.1), rgba(34, 197, 94, 0.04)) !important;
}

html body .chart-trades-tv-zone.is-loss {
  border-color: rgba(239, 68, 68, 0.3) !important;
  background:
    linear-gradient(90deg, rgba(239, 68, 68, 0.11), rgba(239, 68, 68, 0.04)) !important;
}

html body .chart-trades-tv-entry {
  position: absolute !important;
  left: 0 !important;
  right: 0 !important;
  height: 0 !important;
  border-top: 1px solid rgba(250, 204, 21, 0.82) !important;
  box-shadow: none !important;
}

html body .chart-trades-tv-label,
html body .chart-trades-tv-price {
  position: absolute !important;
  z-index: 2 !important;
  /* Fixed, not percentage-of-parent: the zone underneath is honestly
     anchored to real candles and can become very narrow at high zoom-out,
     but the label must stay readable regardless of that width. The box
     itself has no overflow:hidden, so this is free to render past the
     zone's own (possibly thin) bounds without being clipped. */
  max-width: 190px !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  border-radius: 4px !important;
  font-size: 9px !important;
  font-weight: 600 !important;
  line-height: 1 !important;
  transform: translateY(-50%) !important;
}

html body .chart-trades-tv-label {
  left: 4px !important;
  padding: 2px 4px !important;
  color: rgba(255, 247, 204, 0.86) !important;
  background: rgba(8, 12, 22, 0.58) !important;
  border: 1px solid rgba(250, 204, 21, 0.22) !important;
}

html body .chart-trades-tv-price {
  display: none !important;
  right: 4px !important;
  padding: 2px 4px !important;
  color: rgba(229, 237, 247, 0.82) !important;
  background: rgba(8, 12, 22, 0.5) !important;
}

html body .chart-trades-tv-price.is-target {
  border: 1px solid rgba(34, 197, 94, 0.22) !important;
}

html body .chart-trades-hover-tooltip {
  position: fixed !important;
  z-index: 100000 !important;
  width: min(260px, calc(100vw - 24px)) !important;
  pointer-events: none !important;
  color: #e5edf7 !important;
  font: 12px/1.35 system-ui, -apple-system, "Segoe UI", Arial, sans-serif !important;
}

html body .chart-trades-hover-tooltip[hidden] {
  display: none !important;
}

html body .chart-trades-hover-card {
  border: 1px solid rgba(148, 163, 184, 0.24) !important;
  border-radius: 8px !important;
  background: rgba(3, 7, 18, 0.94) !important;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.38) !important;
  padding: 10px 11px !important;
  backdrop-filter: blur(10px) !important;
}

html body .chart-trades-hover-card.is-win {
  border-color: rgba(34, 197, 94, 0.46) !important;
}

html body .chart-trades-hover-card.is-loss {
  border-color: rgba(239, 68, 68, 0.5) !important;
}

html body .chart-trades-hover-title {
  margin: 0 0 3px !important;
  font-weight: 800 !important;
  color: #f8fafc !important;
}

html body .chart-trades-hover-subtitle {
  margin: 0 0 8px !important;
  color: #94a3b8 !important;
  font-size: 11px !important;
}

html body .chart-trades-hover-grid {
  display: grid !important;
  gap: 5px !important;
}

html body .chart-trades-hover-row {
  display: flex !important;
  justify-content: space-between !important;
  gap: 12px !important;
  color: #94a3b8 !important;
}

html body .chart-trades-hover-row strong {
  color: #e5edf7 !important;
  font-weight: 750 !important;
  text-align: right !important;
}

html body .chart-trades-tv-price.is-stop {
  border: 1px solid rgba(239, 68, 68, 0.24) !important;
}

html body .chart-trades-card {
  box-sizing: border-box;
  width: 100%;
  border: 1px solid rgba(93, 110, 135, 0.46);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(8, 13, 25, 0.96), rgba(5, 9, 18, 0.98));
  color: #e5edf7;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}

html body .chart-trades-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(93, 110, 135, 0.28);
  color: #94a3b8;
  font-size: 11px;
  line-height: 1.2;
}

html body .chart-trades-head span {
  color: #cbd5e1;
  font-weight: 700;
}

html body .chart-trades-head strong {
  color: #f8fafc;
  font-weight: 700;
  white-space: nowrap;
}

html body .chart-trades-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
}

html body .chart-trades-history-note {
  padding: 8px 12px 10px;
  border-top: 1px solid rgba(93, 110, 135, 0.22);
  color: #9fb0c7;
  background: rgba(3, 7, 18, 0.42);
  font-size: 11px;
  line-height: 1.35;
}

html body .chart-trades-item {
  box-sizing: border-box;
  padding: 12px;
  border-right: 1px solid rgba(93, 110, 135, 0.22);
}

html body .chart-trades-item.is-alternative,
html body .chart-trades-item.is-weak {
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.22), rgba(15, 23, 42, 0.36));
}

html body .chart-trades-item.is-alternative {
  opacity: 0.82;
}

html body .chart-trades-item:last-child {
  border-right: 0;
}

html body .chart-trades-role {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  margin-bottom: 8px;
  padding: 2px 8px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 999px;
  color: #b6c4d8;
  background: rgba(15, 23, 42, 0.76);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.1;
  text-transform: uppercase;
}

html body .chart-trades-item.is-primary .chart-trades-role {
  color: #d9f99d;
  border-color: rgba(132, 204, 22, 0.28);
  background: rgba(54, 83, 20, 0.36);
}

html body .chart-trades-item.is-alternative .chart-trades-role {
  color: #cbd5e1;
  border-color: rgba(148, 163, 184, 0.22);
  background: rgba(30, 41, 59, 0.46);
}

html body .chart-trades-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-bottom: 8px;
}

html body .chart-trades-side {
  color: #f8fafc;
  font-size: 15px;
  font-weight: 800;
  text-transform: uppercase;
}

html body .chart-trades-main strong {
  color: #facc15;
  font-size: 16px;
  font-weight: 800;
  white-space: nowrap;
}

html body .chart-trades-mode {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  color: #dbeafe;
  background: rgba(30, 41, 59, 0.92);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

html body .chart-trades-mode.is-best {
  color: #dcfce7;
  background: rgba(22, 101, 52, 0.72);
}

html body .chart-trades-mode.is-watch {
  color: #e0f2fe;
  background: rgba(3, 105, 161, 0.68);
}

html body .chart-trades-mode.is-risky,
html body .chart-trades-mode.is-skip {
  color: #fee2e2;
  background: rgba(127, 29, 29, 0.72);
}

html body .chart-trades-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
  color: #9ca3af;
  font-size: 11px;
}

html body .chart-trades-meta span {
  min-height: 20px;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.92);
  white-space: nowrap;
}

html body .chart-trades-prices {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

html body .chart-trades-prices span {
  min-width: 0;
}

html body .chart-trades-prices small {
  display: block;
  margin-bottom: 3px;
  color: #8a98aa;
  font-size: 10px;
  line-height: 1.1;
  text-transform: uppercase;
}

html body .chart-trades-prices b {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
  color: #e5edf7;
  font-size: 12px;
  line-height: 1.16;
}

html body .chart-trades-warning {
  margin-top: 10px;
  padding: 8px 9px;
  border: 1px solid rgba(251, 191, 36, 0.22);
  border-radius: 7px;
  color: #f8d37a;
  background: rgba(120, 74, 0, 0.16);
  font-size: 11px;
  line-height: 1.3;
}

html body .chart-trades-item.is-long .chart-trades-side {
  color: #86efac;
}

html body .chart-trades-item.is-short .chart-trades-side {
  color: #fdba74;
}

html body .chart-trades-card.is-loading,
html body .chart-trades-card.is-empty {
  min-height: 54px;
}

html body .chart-trades-card.is-empty p {
  margin: 0;
  padding: 11px 12px 13px;
  color: #94a3b8;
  font-size: 12px;
}

@media (max-width: 700px) {
  html body .chart-trades-tv-box {
    opacity: 0.74 !important;
  }

  html body .chart-trades-tv-label,
  html body .chart-trades-tv-price {
    max-width: 150px !important;
    font-size: 8px !important;
    font-weight: 600 !important;
    border-radius: 3px !important;
  }

  html body .chart-trades-tv-label {
    padding: 2px 3px !important;
  }

  html body .chart-trades-tv-price {
    padding: 2px 3px !important;
  }

  html body .chart-trades-panel-slot {
    width: calc(100vw - 20px);
    max-width: calc(100vw - 20px);
    margin: 10px calc(50% - 50vw + 10px) 14px;
  }

  html body .chart-trades-head {
    padding: 9px 10px;
  }

  html body .chart-trades-list {
    grid-template-columns: 1fr;
  }

  html body .chart-trades-item {
    padding: 10px;
    border-right: 0;
    border-bottom: 1px solid rgba(93, 110, 135, 0.22);
  }

  html body .chart-trades-item:last-child {
    border-bottom: 0;
  }

  html body .chart-trades-main {
    gap: 7px;
    margin-bottom: 7px;
  }

  html body .chart-trades-side {
    font-size: 14px;
  }

  html body .chart-trades-main strong {
    font-size: 15px;
  }

  html body .chart-trades-meta {
    gap: 5px;
    margin-bottom: 8px;
  }

  html body .chart-trades-prices {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px 10px;
  }
}

@media (max-height: 500px) and (max-width: 960px) {
  html body .chart-trades-panel-slot {
    width: calc(100vw - 20px);
    max-width: calc(100vw - 20px);
    margin: 8px calc(50% - 50vw + 10px) 12px;
  }

  html body .chart-trades-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  html body .chart-trades-item {
    padding: 9px 10px;
    border-bottom: 0;
  }

  html body .chart-trades-prices {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
